package com.ucap.bbs.dao.impl;

import java.util.List;
import java.util.Map;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.ucap.bbs.dao.ITopicDao;
import com.ucap.bbs.pojo.Topic;

public class TopicDaoImpl extends SqlMapClientDaoSupport implements ITopicDao {

	@Override
	public List<Topic> queryTopicListForPage(Topic topic) {
		List<Topic> list = getSqlMapClientTemplate().queryForList("QUERY_TOPIC_LIST_FOR_PAGE", topic);
		return list;
	}

	@Override
	public List<Topic> queryTopicListForRdwt(Topic topic) {
		List<Topic> list = getSqlMapClientTemplate().queryForList("QUERY_TOPIC_RDWT", topic);
		return list;
	}

	@Override
	public List<Map> queryListForIndexBmhfltj() {
		List<Map> list = getSqlMapClientTemplate().queryForList("QUERY_BMHFLTJ");
		return list;
	}

	@Override
	public List<Topic> queryListForIndexZxhf(Topic topic) {
		List<Topic> list = getSqlMapClientTemplate().queryForList("QUERY_TOPIC_ZXHF_LIST_FOR_PAGE", topic);
		return list;
	}

	@Override
	public void addTopic(Topic topic) {
		getSqlMapClientTemplate().insert("INSERT_TOPIC",topic);
	}

	@Override
	public List<Topic> queryTopicList(Topic topic) {
		List<Topic> list = getSqlMapClientTemplate().queryForList("QUERY_TOPIC_LIST", topic);
		return list;
	}

	@Override
	public void updateReplyNum(String guid) {
		getSqlMapClientTemplate().update("UPDATE_REPLY_NUM_FOR_TOPIC",guid);
	}

	@Override
	public Topic queryTopicDetail(String guid) {
		return (Topic)getSqlMapClientTemplate().queryForObject("QUERY_TOPIC_DETAIL",guid);
	}

}
